﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

public class TestService
{
    //OrderRepository orderRepository;

    //public OrderService()
    //{
    //    orderRepository = new OrderRepository();

    //}


    //#region Order
    //public OrderFilterResponse FilterOrder(OrderFilterRequest request)
    //{
    //    OrderFilterResponse response = new OrderFilterResponse();

    //    IQueryable<Order> query = orderRepository.Table();


    //    //if (!string.IsNullOrEmpty(request.Filter))
    //    //{
    //    //    query = query.Where(p => (p.CustomerName.Contains(request.Filter) ));
    //    //}


    //    if (request.SortDirection == SortDirectionEnum.ASC)
    //    {
    //        if (request.SortField == SortFieldEnum.LastModified)
    //        {
    //            query = query.OrderBy(p => p.CreatedOn);
    //        }
    //        if (request.SortField == SortFieldEnum.Name)
    //        {
    //            query = query.OrderBy(p => p.CustomerName);
    //        }
    //    }
    //    else
    //    {
    //        if (request.SortField == SortFieldEnum.LastModified)
    //        {
    //            query = query.OrderByDescending(p => p.CreatedOn);
    //        }
    //        if (request.SortField == SortFieldEnum.Name)
    //        {
    //            query = query.OrderByDescending(p => p.CustomerName);
    //        }
    //    }


    //    int count = query.Count();
    //    int start = request.Paging.Start;
    //    if (start < 0) start = 0;

    //    Pagination paging = request.Paging;
    //    paging.Count = count;
    //    response.Paging = paging;

    //    response.Order = query.Skip(start).Take(request.Paging.Limit).ToList();


    //    return response;
    //}
    //#endregion

}

